unit cmdadd;

interface

uses
    Windows, //LResources
    Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ComCtrls, StdCtrls, Buttons;

type
TCMDType=(add,edit);
  TFcmdAdd = class(TForm)
    U: TBitBtn;
    D: TBitBtn;
    F: TBitBtn;
    B: TBitBtn;
    UB: TBitBtn;
    UF: TBitBtn;
    DB: TBitBtn;
    DF: TBitBtn;
    Label1: TLabel;
    a: TBitBtn;
    BitBtn10: TBitBtn;
    c: TBitBtn;
    x: TBitBtn;
    y: TBitBtn;
    z: TBitBtn;
    s: TBitBtn;
    Label2: TLabel;
    command: TEdit;
    Label3: TLabel;
    Label4: TLabel;
    name: TEdit;
    time: TEdit;
    UpDown1: TUpDown;
    Label5: TLabel;
    barra: TBitBtn;
    til: TBitBtn;
    money: TBitBtn;
    plus: TBitBtn;
    virgula: TBitBtn;
    Label6: TLabel;
    BitBtn21: TBitBtn;
    BitBtn22: TBitBtn;
    procedure DClick(Sender: TObject);
    procedure UClick(Sender: TObject);
    procedure BClick(Sender: TObject);
    procedure FClick(Sender: TObject);
    procedure DBClick(Sender: TObject);
    procedure DFClick(Sender: TObject);
    procedure UBClick(Sender: TObject);
    procedure UFClick(Sender: TObject);
    procedure aClick(Sender: TObject);
    procedure BitBtn10Click(Sender: TObject);
    procedure cClick(Sender: TObject);
    procedure xClick(Sender: TObject);
    procedure yClick(Sender: TObject);
    procedure zClick(Sender: TObject);
    procedure sClick(Sender: TObject);
    procedure barraClick(Sender: TObject);
    procedure tilClick(Sender: TObject);
    procedure moneyClick(Sender: TObject);
    procedure plusClick(Sender: TObject);
    procedure virgulaClick(Sender: TObject);
    procedure timeKeyPress(Sender: TObject; var Key: Char);
    procedure BitBtn22Click(Sender: TObject);
    procedure BitBtn21Click(Sender: TObject);
  private
    { Private declarations }
  public
row:integer;
Cmdtype:TCmdType;
  end;

var
  FcmdAdd: TFcmdAdd;

implementation

uses sprites;

{$R *.DFM}

procedure TFcmdAdd.DClick(Sender: TObject);
begin command.text:=command.text+'D, '; end;

procedure TFcmdAdd.UClick(Sender: TObject);
begin command.text:=command.text+'U, '; end;

procedure TFcmdAdd.BClick(Sender: TObject);
begin command.text:=command.text+'B, '; end;

procedure TFcmdAdd.FClick(Sender: TObject);
begin command.text:=command.text+'F, '; end;

procedure TFcmdAdd.DBClick(Sender: TObject);
begin command.text:=command.text+'DB, '; end;

procedure TFcmdAdd.DFClick(Sender: TObject);
begin command.text:=command.text+'DF, '; end;

procedure TFcmdAdd.UBClick(Sender: TObject);
begin command.text:=command.text+'UB, '; end;

procedure TFcmdAdd.UFClick(Sender: TObject);
begin command.text:=command.text+'UF, '; end;

procedure TFcmdAdd.aClick(Sender: TObject);
begin command.text:=command.text+'a'; end;

procedure TFcmdAdd.BitBtn10Click(Sender: TObject);
begin command.text:=command.text+'b'; end;

procedure TFcmdAdd.cClick(Sender: TObject);
begin command.text:=command.text+'c'; end;

procedure TFcmdAdd.xClick(Sender: TObject);
begin command.text:=command.text+'x'; end;

procedure TFcmdAdd.yClick(Sender: TObject);
begin command.text:=command.text+'y'; end;

procedure TFcmdAdd.zClick(Sender: TObject);
begin command.text:=command.text+'z'; end;

procedure TFcmdAdd.sClick(Sender: TObject);
begin command.text:=command.text+'s'; end;

procedure TFcmdAdd.barraClick(Sender: TObject);
begin command.text:=command.text+'/'; end;

procedure TFcmdAdd.tilClick(Sender: TObject);
begin command.text:=command.text+'~'; end;

procedure TFcmdAdd.moneyClick(Sender: TObject);
begin command.text:=command.text+'$'; end;

procedure TFcmdAdd.plusClick(Sender: TObject);
begin command.text:=command.text+'+'; end;

procedure TFcmdAdd.virgulaClick(Sender: TObject);
begin command.text:=command.text+','; end;

procedure TFcmdAdd.timeKeyPress(Sender: TObject; var Key: Char);
begin if not (Key in['0'..'9','-',Chr(VK_BACK)]) then Key:= #0; end;

procedure TFcmdAdd.BitBtn22Click(Sender: TObject);
begin close; end;

procedure TFcmdAdd.BitBtn21Click(Sender: TObject);
var i:integer;
begin
i:=row;
if cmdtype=edit then begin
formsprites.cmdgrid.row:=row;
formsprites.CmdFile1.Commands[row].Name:=name.text;
formsprites.CmdFile1.Commands[row].command:=command.text;
formsprites.CmdFile1.Commands[row].time:=strtoint(time.text);
formsprites.MontaCmdGrid;
close;
end;
if cmdtype=add then begin
//i:=cmdgrid.row;
formsprites.cmdfile1.AddCommand(Row);
formsprites.CmdFile1.Commands[row].Name:=name.text;
formsprites.CmdFile1.Commands[row].command:=command.text;
formsprites.CmdFile1.Commands[row].time:=strtoint(time.text);
formsprites.MontaCmdGrid;
formsprites.cmdgrid.Row:=i;
close;
end;
end;

//initialization
//  {$I cmdadd.lrs}

end.
